#!/usr/bin/perl

BEGIN {
    my $base_module_dir = (-d '/home5/camecass/perl' ? '/home5/camecass/perl' : ( getpwuid($>) )[7] . '/perl/');
    unshift @INC, map { $base_module_dir . $_ } @INC;
}

print "Content-type: text/plain\n\n";


package MyApp;
use Mojo::Base 'Mojolicious';

# Runs once on application startup
sub startup {
    my $self = shift;
    my $r    = $self->routes;

    # Route prefix for "MyApp::Example" controller
    my $example = $r->under('/example')->to('example#');

    # GET routes connecting the controller prefix with actions
    $example->get('/hello')->to('#hello');
    $example->get('/time')->to('#clock');
    $example->get('/:offset')->to('#restful');

    # All common verbs are supported
    $example->post('/title')->to('#title');

    # And much more
    $r->websocket('/echo')->to('realtime#echo');
}

1;
